﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using X.Infrastructure.WPF.Extends;

namespace X.WPF.Controls.Helpers
{
    /// <summary>
    /// 按钮帮助类
    /// </summary>
    public class ButtonHelper
    {

        #region # 字段及构造器

        /// <summary>
        /// 静态构造器
        /// </summary>
        static ButtonHelper()
        {
            //注册附加属性
            ButtonHelper.CornerRadiusProperty = DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(ButtonHelper), new PropertyMetadata(new CornerRadius(0)));
            ButtonHelper.ContentBehaviorEnableProperty = DependencyProperty.RegisterAttached("ContentBehaviorEnable", typeof(bool), typeof(ButtonHelper), new PropertyMetadata(false, ContentBehaviorEnableChangedCallback));

        }


        /// <summary>
        /// 默认构造器
        /// </summary>
        public ButtonHelper()
        {
        }

        #endregion

        #region # 附加属性 

        #region 圆角半径 —— CornerRadius CornerRadius
        /// <summary>
        /// 圆角半径附加属性
        /// </summary>
        public static DependencyProperty CornerRadiusProperty;

        /// <summary>
        /// 获取圆角半径
        /// </summary>
        /// <param name="dependencyObject"></param>
        /// <returns></returns>
        [AttachedPropertyBrowsableForType(typeof(Button))]
        public static CornerRadius GetCornerRadius(DependencyObject dependencyObject)
        {
            return (CornerRadius)dependencyObject.GetValue(ButtonHelper.CornerRadiusProperty);
        }

        /// <summary>
        /// 设置圆角半径
        /// </summary>
        /// <param name="dependencyObject"></param>
        /// <param name="value"></param>
        [AttachedPropertyBrowsableForType(typeof(Button))]
        public static void SetCornerRadius(DependencyObject dependencyObject, CornerRadius value)
        {
            dependencyObject.SetValue(ButtonHelper.CornerRadiusProperty, value);
        }
        #endregion

        #region 内容按钮行为可用状态 —— ContentBehaviorEnable ContentBehaviorEnable
        /// <summary>
        /// 内容按钮行为可用状态附加属性
        /// </summary>
        public static DependencyProperty ContentBehaviorEnableProperty;

        /// <summary>
        /// 获取内容按钮行为可用状态
        /// </summary>
        /// <param name="dependencyObject"></param>
        /// <returns></returns>
        [AttachedPropertyBrowsableForType(typeof(Button))]
        public static bool GetContentBehaviorEnable(DependencyObject dependencyObject)
        {
            return (bool)dependencyObject.GetValue(ButtonHelper.ContentBehaviorEnableProperty);
        }

        /// <summary>
        /// 设置内容按钮行为可用状态
        /// </summary>
        /// <param name="dependencyObject"></param>
        /// <param name="value"></param>
        [AttachedPropertyBrowsableForType(typeof(Button))]
        public static void SetContentBehaviorEnable(DependencyObject dependencyObject, bool value)
        {
            dependencyObject.SetValue(ButtonHelper.ContentBehaviorEnableProperty, value);
        }
        #endregion

        #endregion

        #region # 路由事件

        #endregion

        #region # 事件处理程序

        #endregion

        #region # 回调方法

        #region 内容按钮行为可用状态改变回调 —— static void ContentBehaviorEnableChangedCallback(DependencyObject dependency...
        /// <summary>
        /// 内容按钮行为可用状态改变回调
        /// </summary>
        private static void ContentBehaviorEnableChangedCallback(DependencyObject dependency, DependencyPropertyChangedEventArgs eventArgs)
        { 

        }
        #endregion

        #endregion

        #region # 方法

        // Override


        // Private


        #endregion
    }
}